import Instance from '@/utils/http.ts';


// 获取所有材料类别
export function useGetMaterialTypeAPI(current:number,pageSize:number){
    return Instance({
        url:'/material-type/getAll',
        method:'GET',
        params: {current: current, pageSize: pageSize}
    })
}

// 获取所有材料类别数量，部分层级
export function useGetMaterialTypeCountAPI(){
    return Instance({
        url:'/material-type/getAllMaterialTypeCount',
        method:'GET'
    })
}

// 获取所有材料类别，部分层级
export function useGetMaterialTypeListAPI(current:number,pageSize:number){
    return Instance({
        url:'/material-type/getAllMaterialType',
        method:'GET',
        params: {current: current, pageSize: pageSize}
    })
}

// 新增材料类别
export function saveOne(materialType:{}) {
    return Instance({
            url:'/material-type/saveOne',
            method: 'POST',
            data:materialType
        }
    )

}

// 修改材料类别
export function updateById(materialType:{}) {
    return Instance({
            url:'/material-type/modifyOne',
            method: 'PUT',
            data:materialType
        }
    )
}
// 删除材料类别
export function deleteById(id:number) {
    return Instance({
            url:'/material-type/'+`${id}`,
            method: 'DELETE',
        }
    )
}
// 根据id查询材料类别
export function getById(id:number) {
    return Instance({
            url:'/material-type/'+`${id}`,
            method: 'GET',
        }
    )
}